Skip to main content

Visa OCR API

The following document highlights the details of the Visa OCR API.

API Description

Objective

The Visa OCR API extracts data from visa documents using Optical Character Recognition (OCR) technology and returns the information in JSON format.

Visa OCR API
This API supports three major visa document variants: printed, digital, and stamped. The API is country-agnostic and can process visa documents from most countries, provided the documents contain relevant keywords that enable detection.
InputOutput
The image of a visa documentOCR results containing visa number, issue date, validity date, confidence scores, and review flags
classifier logic
The Visa classifier, which is the document identification mechanism used by the Visa OCR API, is primarily keyword-based and uses fuzzy matching to identify specific keywords such as "VISA", "Migration", and other relevant terms to detect and validate visa documents.

API URL

https://ind-engine.thomas.hyperverge.co/v1/visaOCR

API Endpoint

visaOCR

Overview

The Visa OCR API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format, and you should upload all images and files as form-data through a POST request.

Method - POST

Authentication

You need a unique pair of application ID ( appId ) and application key ( appKey ) from HyperVerge to verify your identity for accessing the Visa OCR API.

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-type MandatoryThis parameter defines the media type for the request payloadmultipart/form-data
appId MandatoryThe application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
appKey MandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value

Inputs

The following table provides the details of the parameters required for the Visa OCR API's request body:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
imageMandatoryfileThe visa document image file to be processedImage file (JPEG, JPG, or PNG) with a maximum size of 6MB, or a PDF fileNot Applicable
Caution
  • When multiple images are included in a single API request, only one image is processed. Ensure that each API call contains a single image.
  • For PDF files with multiple pages, only the first page is processed for OCR extraction.

Request

The following code snippet demonstrates a standard curl request for the Visa OCR API:

curl --location --request POST 'https://ind-engine.thomas.hyperverge.co/v1/visaOCR' \
--header 'appid: <Enter_the_appId-Shared-by-HyperVerge>' \
--header 'appkey: <Enter_the_appKey-shared-by-HyperVerge>' \
--form 'image=@"<Enter_the_image_file_path>"'

Document Sample

The following is a sample Visa document:

Sample visa document for OCR processing

Supported Visa Variants

The API supports OCR extraction from three major visa document variants:

  • Printed Visas: Traditional printed visa documents with standard formatting

    Sample visa document for OCR processing

  • Digital Visas: Electronically generated visa documents

    Sample visa document for OCR processing

  • Stamped Visas: Physical visa stamps on passport pages

    Sample visa document for OCR processing

Success Response

The following code snippet demonstrates a success response from the Visa OCR API:

{
"status": "success",
"statusCode": 200,
"metaData": {
"requestId": "<Request_ID>"
},
"result": [
{
"details": {
"visa_number": {
"value": "<Visa_Number>",
"conf": <Confidence_Score>,
"to-be-reviewed": "<Review_Flag>"
},
"issue_date": {
"value": "<Issue_Date>",
"conf": <Confidence_Score>,
"to-be-reviewed": "<Review_Flag>"
},
"validity": {
"value": "<Validity_Date>",
"conf": <Confidence_Score>,
"to-be-reviewed": "<Review_Flag>"
}
},
"type": "visa"
}
]
}

Success Response Details

The following table outlines the details of the success response from the Visa OCR API:

ParameterTypeDescription
statusstringThe status of the API request indicating success or failure
statusCodeintegerThe HTTP status code for the response
metaDataobjectThe JSON object containing request identifiers
requestIdstringThe unique identifier for tracking the request
resultarrayThe array containing the extracted visa information
detailsobjectThe JSON object containing the extracted visa fields
visa_numberobjectThe object containing the unique visa identification number extracted from the document
visa_number.valuestringThe extracted visa number value from the visa document
visa_number.conffloatThe confidence score for the visa number extraction, ranging from 0 to 1, where 0 indicates low confidence and 1 indicates high confidence
visa_number.to-be-reviewedstringThe flag indicating if manual review is required for the visa number, set to "yes" when confidence is low or when validity period exceeds 10 years, otherwise "no"
issue_dateobjectThe object containing the date when the visa was issued, extracted from the document
issue_date.valuestringThe extracted issue date value in DD/MM/YYYY format
issue_date.conffloatThe confidence score for the issue date extraction, ranging from 0 to 1, where 0 indicates low confidence and 1 indicates high confidence
issue_date.to-be-reviewedstringThe flag indicating if manual review is required for the issue date, set to "yes" when confidence is low or when validity period exceeds 10 years, otherwise "no"
validityobjectThe object containing the date when the visa expires, extracted from the document
validity.valuestringThe extracted validity date value in DD/MM/YYYY format
validity.conffloatThe confidence score for the validity date extraction, ranging from 0 to 1, where 0 indicates low confidence and 1 indicates high confidence
validity.to-be-reviewedstringThe flag indicating if manual review is required for the validity date, set to "yes" when confidence is low or when validity period exceeds 10 years, otherwise "no"
typestringThe document type identifier, which always returns "visa" for visa documents

Failure Response

The following code snippet demonstrates a failure response from the Visa OCR API:

{
"status": "failure",
"statusCode": 400,
"message": "Input Validation Error: requires property \"image\""
}

Error Responses

The following are some error responses from the Visa OCR API:

{
"message": "Input Validation Error: requires property \"image\"",
"statusCode": 400,
"status": "failure"
}

Error Response Details

A failure or error response contains a failure status with a relevant status code and error message.
The following table lists all error responses:

Status CodeError MessageError DescriptionError Resolution
400Input Validation Error: requires property "image"The request is missing the required image parameterEnsure the request includes the image parameter with a valid image file
400Image size cannot be greater than 6MBThe uploaded image file exceeds the maximum allowed size of 6MBCompress or resize the image to ensure it is under 6MB before uploading
422Document Not DetectedThe request does not contain a valid visa document, or a non-visa document was uploadedEnsure the uploaded image contains a valid visa document with standard visa-related keywords for successful detection
500internal server errorAn unexpected server error occurred during processingCheck the request headers or contact the HyperVerge team for resolution
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: